package P089_enumLimit;

import org.junit.Test;

import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;

/**
 * @Description : 枚举限制在64个以内
 **/
public class EnumLimit {

    /**
     * RegularEnumSet addAll方法的elements元素,它使用了无符号右移操作,符号位为0,并补充地位,简单的说,Java把一个不多于64个枚举项的枚举映射到了一个long类型变量
     * JumboEnumSet类把枚举项按照64个元素一组拆分了多组,每组都映射到一个long类型的数组
     */
    @Test
    public void test() {

        EnumSet<Season> seasons = EnumSet.allOf(Season.class);
        EnumSet<Season1> seasons1 = EnumSet.allOf(Season1.class);
        System.out.println(seasons.size());
        System.out.println(seasons1.size());

        System.out.println(seasons.getClass());
        System.out.println(seasons1.getClass());

    }



    enum Season {
        s1, s2, s3, s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,
        s21,s22,s23,s24,s25,s26,s27,s28,s29,s30,s31,s32,s33,s34,s35,s36,s37,s38,s39,
        s40,s41,s42,s43,s44,s45,s46,s47,s48,s49,s50,s51,s52,s53,s54,s55,s56,s57,s58,s59,
        s60,s61,s62,s63,s64;

    }


    enum Season1 {
        s1, s2, s3, s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,
        s21,s22,s23,s24,s25,s26,s27,s28,s29,s30,s31,s32,s33,s34,s35,s36,s37,s38,s39,
        s40,s41,s42,s43,s44,s45,s46,s47,s48,s49,s50,s51,s52,s53,s54,s55,s56,s57,s58,s59,
        s60,s61,s62,s63,s64,s65;
    }


}
